#region Header

// MS codename Velocity Distributed Cache Extensions.
// (c) 2009

#endregion


#region Usings

using System;

#endregion


namespace Caching.Extensions.Core
{
    /// <summary>
    /// Local Strorage Interface for SmartCache
    /// </summary>
    /// <remarks>
    /// Abstraction for Local-Storage
    /// </remarks>
    public interface ISmartCacheLocalStorage
    {
        /// <summary>
        /// Get total count of items in cache.
        /// </summary>
        /// <returns>Total number of items (expired + non-expired)</returns>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
        int GetTotalCount();


        /// <summary>
        /// Get count of non-expired items in cache
        /// </summary>
        /// <returns>Number of non-expired items</returns>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
        int GetLiveItemCount();


        /// <summary>
        /// Put item into cache
        /// </summary>
        /// <param name="key">item key</param>
        /// <param name="item">item</param>
        /// <exception cref="ArgumentNullException">If key is null</exception>
        void Put(SmartCacheKey key, SmartCacheItem item);


        /// <summary>
        /// Get item from cache
        /// </summary>
        /// <param name="key">item key</param>
        /// <returns>Cached data. Null if item not found or expired</returns>
        /// <exception cref="ArgumentNullException">If key is null</exception>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
        SmartCacheItem Get(SmartCacheKey key);


        /// <summary>
        /// OnRemove item from cache
        /// </summary>
        /// <param name="key">item key</param>
        /// <exception cref="ArgumentNullException">If key is null</exception>
        void Remove(SmartCacheKey key);


        SmartCacheEventPublisher NotificationEvents { get; }
    }
}